package chen.web.install;

import java.io.File;
import java.io.IOException;
import java.net.URL;

public class InstalledFlag {
	
	private static final String InstallFlagFileName = "install";
	
	private static Boolean installed = null;
	public static boolean installed(){
		if(installed == null){
			URL resource = InstalledFlag.class.getResource("/" + InstallFlagFileName);
			if(resource == null){
				installed = true;
			} else {
				installed = false;
			}
		}
		return installed;
	}
	
	static void setInstalled() throws IOException{
		installed = true;
		String path = InstalledFlag.class.getResource("/").getPath() + File.separator + InstallFlagFileName;
		File file = new File(path);
		file.delete();
	}
	
}
